@extends('default.mobile.layouts.noHead')
@section('title'){{$find_job.'_'.Site::get('webname')}} @endsection
{{--首页css--}}
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/mobile/index/personal_info.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/mobile/company/common.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/mobile/jquery/select.css')}}">

@endsection

{{--主体内容--}}
@section('content')
    <div class="resumetop">
        <div class="res_header"><a onclick="history.go(-1)" class="back"></a>
            <div class="pic"><img src="{{$resume->avatar}}" alt=""></div>
        </div>
        <div class="coment">
            <p>
                @if(!auth()->guard('company')->check())
                    @if($resume->sex == '男')
                        {{ mb_substr($resume->name,0,1)}}先生
                    @else
                        {{ mb_substr($resume->name,0,1)}}女士
                    @endif
                @else
                    {{ str_limit($resume->name,16) }}
                @endif
            </p>
            @if(!empty($resume->education))<span>{{ $resume->education }}</span> @endif
            @if(!empty($resume->work_year))<span>|</span><span>{{ $resume->work_year }}</span> @endif
            @if(!empty($resume->job_status))<span>|</span><span>{{ $resume->job_status }}</span> @endif
        </div>
        <div class="bg"></div>
    </div>
    <div class="resumeblock">
        <div class="title">基本信息</div>
        <ul>
            <li><span>性&emsp;&emsp;别</span><em>{{ $resume->sex }}</em></li>
            <li><span>出生日期</span><em>{{ substr($resume->birthday,0,7) }}</em></li>
            <li><span>最高学历</span><em>{{ $resume->education }}</em></li>
            <li><span>婚姻状况</span><em>{{ $resume->marital }}</em></li>
            <li><span>户籍地址</span><em>{{ $resume->census }}</em></li>
            <li><span>身&emsp;&emsp;高</span><em>{{ $resume->height }}</em></li>
            <li><span>居住地</span><em>{{ $resume->homeaddress }}</em></li>
            @if(!empty($resume->address))
                <li><span>详细地址</span><em>{{ $resume->address }}</em></li>@endif
        </ul>
    </div>
    <div class="resumeblock">
        <div class="title">求职意向</div>
        <ul>
            <li><span>意向岗位</span><em>{{ $resume->intentionjobs }}</em></li>
            <li><span>工作地区</span><em>{{ $resume->jobarea }}</em></li>
            <li><span>工作岗位</span><em>{{ $resume->jobsort }}</em></li>
            <li><span>希望薪资</span><em>{{ $resume->expectedsalary }}</em></li>
        </ul>
    </div>
    <div class="resumeblock">
        <div class="title">
            <span>联系方式</span><span class="look">
             @if($lookStatus != 3)
                    @if(!(($lookStatus == 1 || $lookStatus == 2) && Auth::guard('company')->check()))
                        <a class="{{ $look_button }}" id="contactButton">[查看联系方式]</a>
                    @endif
                @endif
   </span>
        </div>
        @if($lookStatus == 3)
            <ul id="personContact">
                <li><span>手机号码</span><em>{{ $resume->mobile }}</em></li>
                <li><span>电子邮箱</span><em>{{ $resume->email }}</em></li>
            </ul>
        @elseif(($lookStatus == 1 || $lookStatus == 2) && Auth::guard('company')->check())
            <ul id="personContact">
                <li><span>手机号码</span><em>{{ $resume->mobile }}</em></li>
                <li><span>电子邮箱</span><em>{{ $resume->email }}</em></li>
            </ul>
        @else
            <ul id="personContact">
                <li><span>手机号码</span><em>{{ $resume->strmobile }}</em></li>
                <li><span>电子邮箱</span><em>{{ $resume->stremail }}</em></li>
            </ul>
        @endif
    </div>
    @if(count($ResumeWorkExp) > 0)
        <div class="resumeblock">
            <div class="title">自我评价</div>
            <div class="content">
                {!! nl2br(e($resume->introduction)) !!}
            </div>
        </div>
    @endif
    @if(count($ResumeWorkExp) > 0)
        <div class="resumeblock">
            <div class="title">工作经验</div>
            <div class="experience_main">
                @foreach($ResumeWorkExp as $v)
                    <div class="experience_box">
                        <span class="time"><em></em>{{$v->starttime}}~{{$v->endtime}}</span>
                        <strong>{{ $v->post }}</strong>
                        <span class="title">{{ $v->company }}</span>
                    </div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($ResumeEducationExp) > 0)
        <div class="resumeblock">
            <div class="title">教育经历</div>
            <div class="experience_main">
                @foreach($ResumeEducationExp as $v)
                    <div class="experience_box">
                        <span class="time"><em></em>{{$v->starttime}}~{{$v->endtime}}</span>
                        <strong>{{ $v->speciality }}</strong>
                        <span class="title">{{ $v->school }}</span>
                    </div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($trainExp) > 0)
        <div class="resumeblock">
            <div class="title">培训经历</div>
            <div class="experience_main">
                @foreach($trainExp as $v)
                    <div class="experience_box">
                        <span class="time"><em></em>{{$v->starttime}}~{{$v->endtime}}</span>
                        <strong>{{ $v->speciality }}</strong>
                        <span class="title">{{ $v->school }}</span>
                    </div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($ResumeProjectExp) > 0)
        <div class="resumeblock">
            <div class="title">项目经验</div>
            <div class="experience_main">
                @foreach($ResumeProjectExp as $v)
                    <div class="experience_box">
                        <span class="time"><em></em>{{$v->starttime}}~{{$v->endtime}}</span>
                        <strong>{{ $v->project_name }}</strong>
                        <span class="title">{{ $v->post }}</span>
                    </div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($ResumeLanguageSkill) > 0)
        <div class="resumeblock">
            <div class="title">语言能力</div>
            <div class="infolist">
                @foreach($ResumeLanguageSkill as $v)
                    <div class="infoitem"><strong>{{ $v->language }}</strong><span>|</span><span>{{ $v->degree }}</span>
                    </div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($ResumeSkill) > 0)
        <div class="resumeblock">
            <div class="title">技能专长</div>
            <div class="infolist">
                @foreach($ResumeSkill as $v)
                    <div class="infoitem">
                        <strong>{{ $v->skillname }}</strong><span>|</span><span>{{ $v->degree }}</span></div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($ResumeCertificate) > 0)
        <div class="resumeblock">
            <div class="title">证书</div>
            <div class="infolist">
                @foreach($ResumeCertificate as $v)
                    <div class="infoitem"><strong>{{ $v->certificate_name }}</strong><span>|</span><span>{{ $v->gettime }}
                            年获得</span></div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($ResumeOther) > 0)
        <div class="resumeblock">
            <div class="title">其它信息</div>
            <div class="infolist">
                @foreach($ResumeOther as $v)
                    <div class="infoitem">
                        <strong>{{ $v->title }}</strong>
                        <p>{{ $v->content }}</p>
                    </div>
                @endforeach
            </div>
        </div>
    @endif
    @if(count($works) > 0)
        <div class="resumeblock">
            <div class="title">我的作品</div>
            @foreach($works as $v)
                <div class="pic_list">
                    <div class="avatar"><img src="{{asset($v->worksBelongImg->imgurl)}}" alt=""></div>
                    <dl>
                        <dt>{{ $v->works_name }}</dt>
                        <dd>{{ $v->description }}</dd>
                    </dl>
                </div>
            @endforeach
        </div>
    @endif
    <div class="resumeblock resumelast"></div>
    <!-- B 操作按钮 -->
    <div class="operation">
        <div class="wrap">
            @if(($lookStatus == 1 || $lookStatus == 2) && Auth::guard('company')->check())
                <a href="tel:{{ $resume->mobile }}" class="tel" id="toTel"><img
                            src="{{asset('default/images/mobile/layout/tel.png')}}" alt=""></a>
            @else
                <a class="tel {{ $look_button }}" id="toTel"><img
                            src="{{asset('default/images/mobile/layout/tel.png')}}" alt=""></a>
            @endif
            <a class="send {{ $interview_button }}">面试邀请</a>
        </div>
    </div>
    <!-- E 操作按钮 -->
    <div style="display: none;"><input type="hidden" id="haveBuyResume" value="{{ $lookStatus }}"></div>
    <!-- E分页 -->
@endsection
@section('footerjs')
    @parent
    <script type="text/javascript" src="{{asset('/default/js/mobile/jquery/jquery.textarea.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/mobile/jquery/jquery.select.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/mobile/index/inviteinterview.js')}}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/mobile/jquery/jquery.textarea.js") }}"></script>
    <script type="text/javascript" src="{{ asset("/default/js/mobile/jquery/zepto.scroll.js") }}"></script>
    <script type="text/javascript" src="{{ asset('/default/js/index/interview.js') }}"></script>
    <script type="text/javascript">
        var resumeId = "{{ $resume->id }}";
        var _token = "{{ csrf_token() }}";
        //邀请面试时间的默认值
        var interViewTime = "{{ date('Y-m-d',strtotime('+1 days')).'T10:00:00'}}";
        //绑定查看联系方式
        $(".button1").click(function(){
            current = $(this);

            if($('#haveBuyResume').val() == 0){//还未购买简历，进行询问
                layer.open({
                    content: '查看该简历将消耗1份简历数？'
                    , btn: ['继续查看', '稍候再看']
                    , yes: function(index){
                        showContact();
                        layer.close(index);
                    }
                });
            }
        });
        /**
         * 显示联系方式
         */
        function showContact(){
            $.post('/mobile/company/personcontact', {
                '_token': _token,
                'resumeId': resumeId
            }, function(data){
                switch(data.status){
                    case 0:
                        layerMsg('亲，您的简历数已用尽。', 2);
                        break;
                    case 1:
                        @if(auth()->guard('company')->check())
                                html = '';
                        html += "<li><span>手机号码</span><em>" + data.mobile + "</em></li>";
                        html += "<li><span>电子邮箱</span><em>" + data.email + "</em></li>";
                        $('#haveBuyResume').val(1);
                        $('#personContact').html(html);
                        $('#contactButton').html('');
                        $("#toTel").attr("href", "tel:" + data.mobile);
                        @endif
                                break;
                    case 2:
                        //提示充值
                        layerMsg('亲，您的会员已到期或简历数已用尽。', 2);
                        break;
                }
            });
        }
    </script>
@endsection